A view representing the number of elements of the specified view satisfying a condition.

Namespace:  C1.LiveLinq
Assembly:  C1.Silverlight.LiveLinq (in C1.Silverlight.LiveLinq.dll)

Syntax

C#
public static AggregationView<T, int> LiveCount<T>(
	this View<T> source,
	Expression<Func<T, bool>> predicate
)
Visual Basic
<ExtensionAttribute> _
Public Shared Function LiveCount(Of T) ( _
	source As View(Of T), _
	predicate As Expression(Of Func(Of T, Boolean)) _
) As AggregationView(Of T, Integer)

Parameters

source
Type: C1.LiveLinq.LiveViews..::..View<(Of <(<'T>)>)>
A view that contains elements to be tested and counted.
predicate
Type: System.Linq.Expressions..::..Expression<(Of <(<'Func<(Of <(<'T, Boolean>)>)>>)>)>
A function to test each element for a condition.

Type Parameters

T
The type of the elements of source.

Remarks

It is possible to use standard LINQ query operator Count instead of LiveCount. Both are "live" in the sense that they are recomputed automatically when any change occurs in the source. The difference is that Count will every time loop through the entire source collection and aggregate it from scratch, whereas LiveCount will use a more performant algorithm, will maintain its value incrementally, processing only those source items that actually changed.

See Also